package fly.text;

import fly.help.PrintSupport;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class SimpleDateFormatDemo {

    public static void main(String[] args) {
        PrintSupport.sout("1");
        SimpleDateFormat sdf = new SimpleDateFormat();

        Date dt = new Date();
        System.out.println( dt.toString() );
        System.out.println( sdf.format( dt));
        System.out.println( sdf.toLocalizedPattern() );
        System.out.println( sdf.toPattern() );
        System.out.println( sdf.toString() );

        PrintSupport.sout("2");
        String pattern = "yyyy-mm-dd";
        SimpleDateFormat sdfp = new SimpleDateFormat(pattern);
        System.out.println( sdfp.format(dt));
        System.out.println( sdfp.toLocalizedPattern() );
        System.out.println( sdfp.toPattern() );
        System.out.println( sdfp.toString() );

        PrintSupport.sout("3");
        SimpleDateFormat sdfpl = new SimpleDateFormat(pattern, Locale.US );
        System.out.println( sdfpl.format(dt) );
        System.out.println( sdfpl.toLocalizedPattern() );
        System.out.println( sdfpl.toPattern() );
        System.out.println( sdfpl.toString() );
    }
}
